<template>
	<view class="box-content">
		<view class="message-content">
			<view class="title-lines">
				<view class="title">{{title}}</view>
				<view class="time">{{detail.create_time}}</view>
			</view>
			<view class="message-detail">
				{{detail.title}}
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				content:'<p>sdsdsdsdsd</p>',
				detail:{},
				status:[
					{"type":1,"title":'新订单'},
					{"type":2,"title":'支付完成'},
					{"type":3,"title":'技师接单'},
					{"type":4,"title":'开始服务'},
					{"type":5,"title":'服务中'},
					{"type":6,"title":'服务变更'},
					{"type":7,"title":'服务完成'},
					{"type":8,"title":'用户评价'},
					{"type":9,"title":'申请售后'},
					{"type":10,"title":'售后已处理'},
					{"type":11,"title":'申请退款'},
					{"type":12,"title":'退款审核通过'},
					{"type":13,"title":'退款审核不通过'}
				]
			}
		},
		onLoad(option) {
			const eventChannel = this.getOpenerEventChannel();
			this.detail = eventChannel.listener.detaildata[0].fn
			if(option.type == 1){
				this.redOrderMessage()
			}else{
				this.redMessage()
			}
			if(this.detail.type){
				this.status.map(item=>{
					if(item.type == this.detail.type){
						this.title = item.title
					}
				})
			}else{
				this.title = '系统消息'
			}
			
		},
		methods:{
			redMessage(){
				let that = this
				this.request.httpTokenRequest({
					url: "message/setSysReadStatus",
					method: "get"
				}, {
					id:this.detail.id
				}).then(res => {
					if (res.code == 0) {
						
					} else {
						this.$util.msg(res.msg)
						return
					}
				}, error => {})
			},
			redOrderMessage(){
				let that = this
				this.request.httpTokenRequest({
					url: "message/setOrderReadStatus",
					method: "get"
				}, {
					id:this.detail.id
				}).then(res => {
					if (res.code == 0) {
						
					} else {
						this.$util.msg(res.msg)
						return
					}
				}, error => {})
			}
		}
	}
</script>

<style lang="scss">
	.message-content{
		background-color: #fff;
		border-radius: 20rpx;
		padding: 30rpx;
		// margin-top: var(--status-bar-height);
		.title-lines{
			border-bottom: 1rpx solid #D6D6D6;
			padding-bottom: 30rpx;
			.title{
				font-size: 28rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				color: #08090A;
			}
			.time{
				font-size: 22rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				color: #A3A3A3;
				margin-top: 10rpx;
			}
		}
		.message-detail{
			padding: 30rpx 0;
		}
	}
</style>